<template>
	<view class="main">
		<view class="items">
			<view class="item" @click="gotoDetail(item)" v-for="(item,index) in datas" :key="index">
				<view class="p-name">{{item.content}}</view>
				<view class="c-name">系统名称：{{item.sys_name}}</view>
				<view class="foud-bg"><text class="foud-name">提出公司：{{item.company}}</text></view>
				<view class="foud-time"><text class="plan-time">提出时间：{{item.propose_time}}</text><text class="pay-time">提出人：{{item.name}}</text></view>
			</view>
		</view><!--items end-->
	</view>
</template>

<script>
	import {getList} from '@/api/question.js'
	export default {
		data() {
			return {
				page:1,
				limit:10,
				status:false,
				datas:[]
			}
		},
		onLoad() {
			this.getDataList();
		},
		onPullDownRefresh() {
			this.page = 1;
			this.getDataList();
		},
		onReachBottom: function() {
			this.getDataList();
		},
		methods: {
			gotoDetail(item){
				uni.navigateTo({
					url:'/pages/index/list/data?id='+item.id
				})
			},
			getDataList() {
				let that = this;
				
				let limit = that.limit;
				let page = that.page;
				let dataList = that.datas;
				if (that.status) return;
				getList({
					page: page,
					limit: limit
				}).then(res => {
					let datasNew = [];
					let len = res.data.count;
					datasNew = dataList.concat(res.data.list);
					that.page++;
					that.$set(that, 'datas', datasNew);
					that.status = limit > len;
					that.page = that.page;
				});
			}
		}
	}
</script>

<style lang="scss">
	page {
	  width: 100%;
	  height: 100%;
	  background-color: white;
	}
	.main {
		display: flex;
		flex-direction: column;
		padding: 30rpx;
		padding-bottom: 0;  
		padding-bottom: constant(safe-area-inset-bottom);  
		padding-bottom: env(safe-area-inset-bottom); 
		.items{
			display: flex;
			flex-direction: column;
			.item{
				display: flex;
				flex-direction: column;
				background-color: #FFFFFF;
				box-shadow: 0px 3px 6px 2px rgba(0, 0, 0, 0.1);
				border-radius: 12rpx;
				margin-top: 20rpx;
				padding: 20rpx;
				
				.p-name{
					font-size: 28rpx;
					font-weight: bold;
					overflow: hidden;
					-webkit-line-clamp: 2;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-box-orient: vertical;
				}
				.c-name{
					font-size: 28rpx;
					margin-top: 25rpx;
				}
				.foud-bg{
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: center;
					margin-top: 20rpx;
					.foud-name{
						font-size: 28rpx;
					}
					.foud-amount{
						font-size: 28rpx;
						color: #FF0000;
					}
				}
				.foud-time{
					display: flex;
					flex-direction: row;
					justify-content: space-between;
					align-items: center;
					margin-top: 20rpx;
					margin-bottom: 20rpx;
					.plan-time{
						font-size: 24rpx;
					}
					.pay-time{
						font-size: 24rpx;
					}
				}
			}//item
		}//end items
	}
</style>
